#pragma once
#include "NodeBase.h"
#include <juce_gui_basics/juce_gui_basics.h>

// 带按钮的节点
class NodeWithButton : public NodeBase
{
public:
    NodeWithButton(const juce::String& labelText)
        : NodeBase(labelText)
    {
        addAndMakeVisible(button);
        button.setButtonText("button");
        button.onClick = [this]() { juce::AlertWindow::showMessageBoxAsync(juce::AlertWindow::InfoIcon, "button", "you clicked the button"); };
    }

    void resized() override
    {
        NodeBase::resized();
        // 按钮放在节点右上角
        button.setBounds(getWidth() - 60, (int)(getTitleBarHeight()+15), 50, 24);
    }

private:
    juce::TextButton button;
};